package com.cmict.data.form.api.task;


import com.cmict.data.framework.common.pojo.CommonResult;
import com.cmict.data.form.api.task.dto.SysFromSeachDataVoDTO;
import com.cmict.data.form.api.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 字典数据 API 接口
 *
 * @author awesome
 */
@FeignClient(name = ApiConstants.NAME) // TODO awesome：fallbackFactory =
@Api(tags = "RPC 服务 - 部门")
public interface CurrencyDataApi {

    String PREFIX = ApiConstants.PREFIX + "/data";

    @GetMapping(PREFIX + "/table_list")
    @ApiOperation("获取表单组件属性")
    @ApiImplicitParam(name = "sql", value = "sql", example = "", dataTypeClass = String.class)
    CommonResult<List<String>> getTableNameList(@RequestParam("sql") String sql);

    @GetMapping(PREFIX + "/get")
    @ApiOperation("获取表单组件属性")
    CommonResult selectData(@RequestBody SysFromSeachDataVoDTO sysFromSearchData);

    @PostMapping(PREFIX + "/delete")
    @ApiOperation("获取表单组件属性")
    @ApiImplicitParam(name = "job", value = "", example = "", dataTypeClass = String.class)
    void deleteData(@RequestParam("job")String job);

    @PostMapping(PREFIX + "/list")
    @ApiOperation("获取表单组件属性")
    @ApiImplicitParam(name = "sql", value = "", example = "", dataTypeClass = String.class)
    List<Map<String,Object>> selectDataList(@RequestParam("sql") String sql);

    @PostMapping(PREFIX + "/selectDataByPortal")
    @ApiOperation("获取表单组件属性通过门户")
    CommonResult<List<Map<String, Object>>> selectDataByPortal(@RequestParam("tableName") String tableName, @RequestBody List<Map<String, Object>> dataMapList);

    @PostMapping(PREFIX + "/selectDataByChange")
    @ApiOperation("获取表单组件属性关于变更")
    CommonResult<List<Map<String, Object>>> selectDataByChange(@RequestParam("id") Long id, @RequestBody List<Map<String, Object>> dataMapList);
}
